/**
 * @description 定义产品接口
 */

import { PRODUCT_ADD_URL, DICT_LIST, PRODUCT_APPROVE_List, PRODUCT_APPROVR, PRODUCT_INFO, PRODUCT_LIST, UPLOAD_URL } from "@/config/urls.conf";
import ajax from './ajax'

//获取产品列表
export function productListApi(params){
    return ajax({
        url: PRODUCT_LIST,
        params
    })
}

//获取产品详细信息
export function productInfoApi(id){
    return ajax({
        url: PRODUCT_INFO,
        params:{id}
    })
}

// 获取产品审批信息
export function productApproveListApi(id){
    return ajax({
        url: PRODUCT_APPROVE_List,
        params:{goods_id:id}
    })
}

//获取字典列表
export function dictListApi(type){
    return ajax({
        url:DICT_LIST,
        params:{page:1,size:100,type}
    })
}

// 产品审批信息
export function productApproveApi(data){
    return ajax({
        url: PRODUCT_APPROVR,
        method: 'POST',
        data
    })
}

// 文件上传接口
export function fileUpLoadApi(dir, file){
    return ajax({
        url: UPLOAD_URL + dir,
        method: 'POST',
        data: file
    })
}
// 新增产品接口
export function productAddApi(data){
    return ajax({
        url: PRODUCT_ADD_URL,
        method: 'PUT',
        data
    })
}